home *** CD-ROM | disk | FTP | other *** search
ASP.NET Web Form | 2002-03-17 | 3.4 KB | 61 lines |
- <%@ Page Language="vb" AutoEventWireup="false" Codebehind="DataGridForm.aspx.vb" Inherits="DataBinding.DataGridForm" trace="False" enableViewState="True" enableViewStateMac="False" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <HEAD>
- <title>DataGridForm</title>
- <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
- <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
- <meta content="JavaScript" name="vs_defaultClientScript">
- <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
- </HEAD>
- <body>
- <form id="Form1" method="post" runat="server">
- <H1>DataGrid Control Demo</H1>
- <P>This form demonstrates the main features of the DataGrid control, including
- sortable columns, Edit/Delete buttons, custom templates (eg to render the
- Publisher foreign value and the More Info column to display a link). You can
- modify as many rows you wish, and then perform an update on the real database
- (but in this demo no actual update is performed).</P>
- <P> </P>
- <P><asp:datagrid id="dgrTitles" runat="server" Width="596px" Height="177px" AutoGenerateColumns="False" AllowSorting="True" SortExpr="price">
- <SelectedItemStyle BackColor="Orange"></SelectedItemStyle>
- <EditItemStyle BackColor="Orange"></EditItemStyle>
- <AlternatingItemStyle BackColor="Khaki"></AlternatingItemStyle>
- <HeaderStyle Font-Names="Arial Black" ForeColor="White" BackColor="Black"></HeaderStyle>
- <FooterStyle ForeColor="Blue"></FooterStyle>
- <Columns>
- <asp:TemplateColumn HeaderText="[ ]">
- <ItemTemplate>
- <asp:CheckBox id="chkSelect" runat="server"></asp:CheckBox>
- </ItemTemplate>
- </asp:TemplateColumn>
- <asp:BoundColumn DataField="title" SortExpression="Title" HeaderText="Title"></asp:BoundColumn>
- <asp:TemplateColumn HeaderText="Publisher">
- <ItemTemplate>
- <asp:Label id=lblPublisher runat="server" Text='<%# Container.DataItem.Row.GetParentRow("PubsTitles")("pub_name") %>'>
- </asp:Label>
- </ItemTemplate>
- <EditItemTemplate>
- <asp:DropDownList id="ddlPublishers" runat="server" Width="181px" DataValueField="pub_id" DataTextField="pub_name"></asp:DropDownList>
- </EditItemTemplate>
- </asp:TemplateColumn>
- <asp:BoundColumn DataField="type" SortExpression="Type" HeaderText="Type">
- <HeaderStyle Width="80px"></HeaderStyle>
- </asp:BoundColumn>
- <asp:BoundColumn DataField="price" SortExpression="Price" HeaderText="Price">
- <HeaderStyle Width="50px"></HeaderStyle>
- </asp:BoundColumn>
- <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" HeaderText="Edit" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
- <asp:ButtonColumn Text="Delete" ButtonType="PushButton" HeaderText="Delete" CommandName="Delete"></asp:ButtonColumn>
- <asp:HyperLinkColumn Text="Publisher" DataNavigateUrlField="pub_id" DataNavigateUrlFormatString="/showpubs.aspx?pub_id={0}" HeaderText="More info"></asp:HyperLinkColumn>
- </Columns>
- </asp:datagrid></P>
- <P><asp:button id="btnEval" runat="server" Text="Eval total for selected titles"></asp:button>
- <asp:button id="btnUpdate" runat="server" Text="Update the Pubs Database"></asp:button></P>
- <P><asp:label id="lblTotal" runat="server">[no title is selected]</asp:label></P>
- <P>
- <P> </P>
- </form>
- </body>
- </HTML>
-